/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Nas
 */
@Entity
@Table(name = "CATEGORIA_SERVICIO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CategoriaServicio.findServiciosByCategoria", query = "SELECT cs.idServicio FROM CategoriaServicio cs JOIN FETCH cs.idServicio WHERE cs.idCategoria.idCategoria = :idCategoria"),
    @NamedQuery(name = "CategoriaServicio.findAll", query = "SELECT c FROM CategoriaServicio c"),
    @NamedQuery(name = "CategoriaServicio.findByIdCategServi", query = "SELECT c FROM CategoriaServicio c WHERE c.idCategServi = :idCategServi")})
public class CategoriaServicio implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_CATEG_SERVI")
    private Integer idCategServi;
    @JoinColumn(name = "ID_SERVICIO", referencedColumnName = "ID_SERVICIO")
    @ManyToOne(optional = false)
    private Servicio idServicio;
    @JoinColumn(name = "ID_CATEGORIA", referencedColumnName = "ID_CATEGORIA")
    @ManyToOne
    private Categoria idCategoria;

    public CategoriaServicio() {
    }

    public CategoriaServicio(Integer idCategServi) {
        this.idCategServi = idCategServi;
    }

    public Integer getIdCategServi() {
        return idCategServi;
    }

    public void setIdCategServi(Integer idCategServi) {
        this.idCategServi = idCategServi;
    }

    public Servicio getIdServicio() {
        return idServicio;
    }

    public void setIdServicio(Servicio idServicio) {
        this.idServicio = idServicio;
    }

    public Categoria getIdCategoria() {
        return idCategoria;
    }

    public void setIdCategoria(Categoria idCategoria) {
        this.idCategoria = idCategoria;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCategServi != null ? idCategServi.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CategoriaServicio)) {
            return false;
        }
        CategoriaServicio other = (CategoriaServicio) object;
        if ((this.idCategServi == null && other.idCategServi != null) || (this.idCategServi != null && !this.idCategServi.equals(other.idCategServi))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.CategoriaServicio[ idCategServi=" + idCategServi + " ]";
    }
    
}
